<?php

	include_once('../sys/sys.php');
	include_once ('./data/lndt.php');
	header('Content-Type: text/html; charset=utf-8');
	$action = $_GET['action'];
	$tid = $_GET['tid'];
	
	if(!is_numeric($tid) || $tid < 0){
		show_normal_mesR('TAG ID错误','TAG ID错误','TAG查询');
	}
	//开始获取该ID下的图片
	$DB->build_query(array(
			'select' 	=> '*',
			'from'		=> 'lnstories',
			'where'		=>	'nid=' . $tid,
	));
	$qid = $DB->exec_query();
	$pics = '';
	
	$i = 0;
	while ($row = $DB->fetch_row($qid)) {
		//获取名称以及
		$pre_url = $row['url'];
		$array_piclist[$i]['tagname'] = $row['name'];
		$array_piclist[$i]['count'] = $row['id'];
		$array_piclist[$i]['downloadpicslink'] = SITE_URL . 'ln/picd.php?id=' .$row['id'];
		$array_piclist[$i]['picslink'] = SITE_URL . 'ln/picd.php?id=' .$row['id'];
		$array_piclist[$i]['getnewlink'] = make_story_url($ln_base_link,$row['id'],$ln_s_middle);
		$i++;
	}
	if($action == 'getpicurls'){
		//初始化模版变量
		$page = init_smart_template_obj('ln/plist.html',CACHE_DIR,CACHE_DIR,TEMPLATE_DIR);
		$page->assign("piclist",$array_piclist);
		$page->assign("system",$sysinfo);
		$page->assign("pagelink",$pagelink);
		$page->assign("searchpg",SITE_URL . 'ln/search.php');
		$page->assign("title","小说列表");
		$page->output();
	}
	else if($action == 'getpicfiles'){
		$page = init_smart_template_obj('ln/plist.html',CACHE_DIR,CACHE_DIR,TEMPLATE_DIR);
		$page->assign("piclist",$array_piclist);
		$page->assign("system",$sysinfo);
		$page->assign("pagelink",$pagelink);
		$page->assign("searchpg",SITE_URL . 'ln/search.php');
		$page->assign("title","章节列表");
		$page->output();
	}


	
?>